﻿using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;

namespace FastMvc
{
    /// <summary>
    /// WebApi 启动入口
    /// </summary>
    public class FastServer
    {
        public static void Start<T>(int port) where T : BaseStartUp
        {
            WebHost.CreateDefaultBuilder()
                .ConfigureLogging((c, v) =>
                {
                    v.AddFilter((l) =>
                    {
                        if (l > LogLevel.Warning) return true;
                        else return false;
                    });
                })
                .UseStartup<T>()
                .UseUrls($"http://*:{port}")
                    .Build().Run();
        }
    }
}
